import pdfplumber

def compare_code_in_pdf(pdf_content,code:str):
    '''比对pdf中是否每一页都包含指定code'''
    if code.startswith("XLY"):
        return True
    else:
        with pdfplumber.open(pdf_content) as pdf:
            for page in pdf.pages:
                text = page.extract_text()
                if text:
                    lines = text.splitlines()
                    # 逐条比对lines是否包含code
                    if not any(code in item for item in lines):
                        return False
            return True
